<template>
  <div class="container">
    <header class="header">
      <h1 class="title">所有调度员</h1>
      <div class="button-group">
        <button class="btn" :class="{ active: currentView === 'DispatcherOverview' }" @click="currentView = 'DispatcherOverview'">
          <span>总览</span>
        </button>
        <button class="btn" :class="{ active: currentView === 'DispatcherYoyQoq' }" @click="currentView = 'DispatcherYoyQoq'">
          <span>同比&环比</span>
        </button>
        <button class="btn" :class="{ active: currentView === 'DispatcherComparison' }" @click="currentView = 'DispatcherComparison'">
          <span>数据对比</span>
        </button>
      </div>
    </header>

    <!-- 分隔线 -->
    <div class="divider"></div>

    <!-- 内容区域 - 根据当前选择显示不同组件 -->
    <main class="content">
      <component :is="currentView"></component>
    </main>
  </div>
</template>

<script>
import DispatcherOverview from "./DispatcherOverview.vue";
import DispatcherYoyQoq from "./DispatcherYoyQoq.vue";
import DispatcherComparison from "./DispatcherComparison.vue";

export default {
  data() {
    return {
      currentView: 'DispatcherOverview'
    }
  },
  components: {
    DispatcherOverview,
    DispatcherYoyQoq,
    DispatcherComparison
  }
}
</script>

<style scoped>
.container {
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 0 10px;
}

.header {
  display: flex;
  align-items: center;
  padding: 4px 0;
  gap: 25px;
  flex-wrap: wrap;
}

.title {
  margin: 0;
  font-size: 15px;
  color: rgba(0, 0, 0, 0.80);
  padding: 3px 30px 3px 20px;
  position: relative;
  display: inline-flex;
  align-items: center;
  /* 关键：让背景和边框形状一致 */
  clip-path: polygon(
      0 0,
      calc(100% - 15px) 0,
      100% 100%,
      0 100%
  );
  background-color: #3DE7C9;
}

/* 右侧和上下边框 */
.title::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-style: solid;
  border-color: #3DE7C9;
  border-width: 1px 1px 1px 0; /* 左侧边框已单独设置 */
  clip-path: polygon(
      0 0,
      calc(100% - 8px) 0,
      100% 100%,
      0 100%
  );
  pointer-events: none;
}

.button-group {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 3px 30px;
  border: 1px solid #3DE7C9;
  border-radius: 0;
  background-color: rgba(61, 231, 201, 0.3);
  color: #3DE7C9;
  cursor: pointer;
  font-size: 14px;
  line-height: 14px;
  transition: all 0.3s ease;
  transform: skewX(25deg); /* 向右倾斜的平行四边形 */
  position: relative;
}

.btn span {
  display: inline-block;
  transform: skewX(-25deg); /* 文字反向倾斜保持水平 */
}

.btn:hover {
  background-color: #e0e0e0;
}

.btn.active {
  border: 1px solid #FFE27A;
  background-color: rgba(255, 226, 122, 0.3);
  color: #FFE27A;
}

.divider {
  height: 1px;
  width: 100%;
  background-color: #3DE7C9;
  margin: 2px 0 10px;
}

.content {
  width: 100%;
  min-height: 400px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 4px;
}
</style>
<style lang="scss" scoped>
</style>
